package parser;

import antlr.RecognitionException;
import java.util.*;

class Decorator {
	
    Expr var;
    Parameters params;
    
    Decorator(Expr var, Parameters params) {
	    this.var = var;
        this.params = params;
    }
    
    Expr apply(Expr func) {
        if (params != null) {
            var = new Call(var, params);
        }
        List<Expr> list = new ArrayList<Expr>();
        list.add(func);
        Parameters p = new Parameters(list, new ArrayList<Expr>(), null, null);
        return new Call(var, p);
    }
}
